<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>下单页面</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<img src="img/vivo.jpeg"></br>
价格：<scan>1000</scan></br>

<button id="pay">下单</button>

</body>
<script type="text/javascript">
    $(function (){
        var data = JSON.stringify({
            "orderNo":"001",
            "amount":"1000",
            "status":"00"
        });
        $("#pay").click(function () {
            $.ajax({url:"/order/save",
                data:data,
                type:"POST",
                contentType:"application/json",
                dataType:"json",
                success:function (resp) {
                    if(resp.flag==true){
                        window.location.href="/order_paying.html?id="+resp.obj.id;
                    }else{
                        alert("下单失败！"+resp.msg);
                    }
                }
            })
        })
    })

</script>
</html>